<section class="content-header">
    <h1>
        {{title}}
        <!-- <small>Control panel</small> -->
    </h1>
</section>

<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-md-3 col-md-push-9">
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">查询区域</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <div class="form-group">
                        <label for="DateTimeRange">时间</label>
                        <input type="text" class="form-control pull-right" id="DateTimeRange" placeholder="请选择日期" />
                    </div>
                    <div class="form-group">
                        <label>区域</label>
                        <dx-select-box #subArea style="width:100%;height:35px;margin-bottom:10px;border-radius: 0px" [items]="subAreaItems" displayExpr="subArea"
                            [(selectedItem)]="subAareSelected" (onValueChanged)="onSubAreaSelectedChange($event)" [value]="subAreaItems[0]"
                            [searchEnabled]="true">
                        </dx-select-box>
                    </div>
                    <div class="form-group">
                        <label>设备</label>
                        <dx-drop-down-box #dddb style="width:100%;height:35px;margin-bottom:10px;border-radius: 0px" [(value)]="equipmentSelected"
                            displayExpr="equipment" placeholder="请选择工位" [showClearButton]="true" [dataSource]="equipemntItems">
                            <dxo-drop-down-options [width]="510" [height]="310"></dxo-drop-down-options>
                            <div *dxTemplate="let data of 'content'">
                                <button type="button" (click)="clearEquipmentSelected()" class="btn btn-default btn-sm" title="重置">重置</button>&nbsp;&nbsp;&nbsp;
                                <button type="button" (click)="equipmentSelectedOk()" class="btn btn-info btn-sm" title="确定">确定</button>
                                <dx-data-grid #ddg [dataSource]="equipemntItems" [hoverStateEnabled]="true" [paging]="{ enabled: true, pageSize: 1000 }"
                                    [filterRow]="{ visible: true }" [(selectedRowKeys)]="equipmentSelected" [scrolling]="{ mode: 'infinite' }"
                                    [height]="265" [showColumnLines]="true" [showRowLines]="true" [showBorders]="true" [rowAlternationEnabled]="true">
                                    <dxo-selection [selectAllMode]="allPages" [showCheckBoxesMode]="always" mode="multiple"></dxo-selection>
                                    <dxi-column dataField="equipmentType" caption="设备类型" [width]="100">
                                    </dxi-column>
                                    <dxi-column dataField="supplier" caption="供应商" [width]="100">
                                    </dxi-column>
                                    <dxi-column dataField="stationCode" caption="工位" [width]="100">
                                    </dxi-column>
                                    <dxi-column dataField="equipment" caption="设备" [width]="100">
                                    </dxi-column>
                                </dx-data-grid>
                            </div>
                        </dx-drop-down-box>
                    </div>
                    <div class="form-group">
                        <label>班次</label>
                        <dx-select-box #shift style="width:100%;height:35px;margin-bottom:10px;border-radius: 0px" [items]="shiftItems" displayExpr="shiftName"
                            [(selectedItem)]="shiftSelected" [value]="shiftItems[0]" [searchEnabled]="true">
                        </dx-select-box>
                    </div>
                </div>
                <div class="box-footer">
                    <button type="button" class="btn btn-primary" (click)="getReportData()"> 查 询 </button>
                </div>
            </div>
        </div>
        <div class="col-md-9 col-md-pull-3">
            <div class="box box-default">
                <div class="box-header with-border">
                    <h3 class="box-title">{{title}}查询</h3>
                    <div class="box-tools pull-right">
                        <button type="button" class="btn btn-box-tool" data-widget="collapse">
                            <i class="fa fa-minus"></i>
                        </button>
                    </div>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <dx-data-grid [dataSource]="ctsList" [showColumnLines]="true" [showRowLines]="true" [showBorders]="true" 
                    [rowAlternationEnabled]="true" (onExporting)="onExporting($event)" [columnMinWidth]="50" [columnAutoWidth]="true">
                        <dxo-paging [pageSize]="10"></dxo-paging>
                        <dxo-export [enabled]="true" fileName="TIPCalculation查询" [allowExportSelectedData]="false"></dxo-export>
                        <dxo-pager [showPageSizeSelector]="true" [allowedPageSizes]="[10, 20, 100]" [showInfo]="true">
                        </dxo-pager>
                        <dxi-column dataField="productionDate" caption="日期">
                        </dxi-column>
                        <dxi-column dataField="subArea" caption="生产线">
                        </dxi-column>
                        <dxi-column dataField="resource" caption="来源">
                        </dxi-column>
                        <dxi-column dataField="equipment" caption="设备">
                        </dxi-column>
                        <dxi-column dataField="shift" caption="班次">
                        </dxi-column>
                        <dxi-column dataField="totCt" caption="总工作循环时间">
                        </dxi-column>
                        <dxi-column dataField="totPt" caption="自动运行时间">
                        </dxi-column>
                        <dxi-column dataField="numNcyc" caption="循环次数">
                        </dxi-column>
                        <dxi-column dataField="totFt" caption="停机时间">
                        </dxi-column>
                        <dxi-column dataField="numFlt" caption="停机次数">
                        </dxi-column>
                        <dxi-column dataField="totBt" caption="堵塞时间">
                        </dxi-column>
                        <dxi-column dataField="totSt" caption="待料时间">
                        </dxi-column>
                        <dxi-column dataField="totOt" caption="循环超时">
                        </dxi-column>
                        <dxi-column dataField="target" caption="目标产量">
                        </dxi-column>
                        <dxi-column dataField="gdParts" caption="合格品产量">
                        </dxi-column>
                        <dxi-column dataField="rjParts" caption="不合格品产量">
                        </dxi-column>
                        <dxi-column dataField="goodProcess" caption="合格品的加工时间">
                        </dxi-column>
                        <dxi-column dataField="scrapProcess" caption="不合格品的加工时间">
                        </dxi-column>
                        <dxi-column dataField="targetWorktime" caption="理论工作时间">
                        </dxi-column>
                        <dxi-column dataField="totalWorktime" caption="总工作时间">
                        </dxi-column>
                        <dxi-column dataField="purchCycle" caption="规划节拍">
                        </dxi-column>
                        <dxi-column dataField="avgCycle" caption="实际平均节拍">
                        </dxi-column>
                        <dxi-column dataField="cycleDiff" caption="cycleDiff">
                        </dxi-column>
                        <dxi-column dataField="downMTTR" caption="平均停机时间">
                        </dxi-column>
                        <dxi-column dataField="downMCBF" caption="平均停机频次">
                        </dxi-column>
                        <dxi-column dataField="saa" caption="单机开动率">
                        </dxi-column>
                        <dxi-column dataField="grossJPH" caption="不考虑开动的实际JPH">
                        </dxi-column>
                        <dxi-column dataField="netJPH" caption="考虑开动率的实际JPH">
                        </dxi-column>
                        <dxi-column dataField="purJPH" caption="规划JPH">
                        </dxi-column>
                        <dxi-column dataField="jphDiff" caption="jphDiff">
                        </dxi-column>
                        <dxi-column dataField="avgDown" caption="平均停机时间">
                        </dxi-column>
                        <dxi-column dataField="avgBLK" caption="平均堵塞时间">
                        </dxi-column>
                        <dxi-column dataField="avgSTV" caption="平均待料时间">
                        </dxi-column>
                        <dxi-column dataField="blockedStarved" caption="堵塞待料时间">
                        </dxi-column>


                        <!-- <dxi-column dataField="partType" caption="partType" [width]="70">
                        </dxi-column>
                        <dxi-column dataField="logTime" caption="logTime" [width]="180">
                        </dxi-column>
                        <dxi-column dataField="numOvrc" caption="numOvrc">
                        </dxi-column>
                        <dxi-column dataField="ratedCt" caption="ratedCt">
                        </dxi-column>
                        <dxi-column dataField="numCyc" caption="循环次数">
                        </dxi-column>
                        <dxi-column dataField="totCt2" caption="totCt2">
                        </dxi-column>
                        <dxi-column dataField="totCct" caption="totCct">
                        </dxi-column>
                        <dxi-column dataField="numCcyc" caption="numCcyc">
                        </dxi-column>
                        <dxi-column dataField="totAct" caption="totAct">
                        </dxi-column>
                        <dxi-column dataField="totNct" caption="totNct">
                        </dxi-column> -->

                    </dx-data-grid>
                </div>
            </div>
        </div>
    </div>
</section>